select t2.name, t1.*, t3.name
  from (select sf_delivery_h.pk_org,sum(sf_delivery_h.successtotal) successtotal,T1.pk_org_p
  from sf_delivery_h sf_delivery_h
 inner join sf_delivery_b T1
    ON T1.pk_delivery_h = sf_delivery_h.pk_delivery_h
 where (
       sf_delivery_h.billstatus = 4)
   and sf_delivery_h.dr = 0
   and T1.dr = 0
   and nvl(sf_delivery_h.dr, 0) = 0
  group by sf_delivery_h.pk_org, T1.pk_org_p) t1
  left join (select t.*, level
               from (
                     
                     select code,
                             name,
                             pk_financeorg,
                             pk_fatherorg,
                             pk_corp,
                             pk_group,
                             enablestate
                       from (SELECT org_corp.code,
                                     org_corp.name,
                                     org_corp.pk_corp pk_financeorg,
                                     org_corp.pk_fatherorg,
                                     org_corp.pk_corp,
                                     org_corp.pk_group,
                                     org_financeorg.enablestate
                                FROM org_corp
                                LEFT outer JOIN org_financeorg
                                  ON org_corp.pk_corp =
                                     org_financeorg.pk_financeorg
                               WHERE org_corp.pk_corp IN
                                     (SELECT pk_org
                                        FROM org_orgs
                                       WHERE orgtype5 = 'Y')
                              UNION
                              SELECT org_financeorg.code,
                                     org_financeorg.name,
                                     org_financeorg.pk_financeorg,
                                     org_orgs.pk_corp pk_fatherorg,
                                     org_orgs.pk_corp,
                                     org_financeorg.pk_group,
                                     org_financeorg.enablestate
                                FROM org_financeorg
                                LEFT outer JOIN org_orgs
                                  ON org_financeorg.pk_financeorg =
                                     org_orgs.pk_org
                               WHERE orgtype5 = 'Y'
                                 AND org_financeorg.pk_financeorg <>
                                     org_orgs.pk_corp) org_financeorg_temp
                      where 11 = 11
                        and (enablestate = 2)
                        and ((pk_group =
                            (select pk_group
                                 from org_corp
                                where pk_fatherorg = '~')))
                      order by code) t
              start with pk_financeorg =
                         (select pk_corp
                            from org_corp
                           where pk_fatherorg = '~')
             connect by prior pk_financeorg = pk_fatherorg
              order by level) t2
    on t1.pk_org = t2.pk_financeorg

  left join (select t.*, level
               from (
                     
                     select code,
                             name,
                             pk_financeorg,
                             pk_fatherorg,
                             pk_corp,
                             pk_group,
                             enablestate
                       from (SELECT org_corp.code,
                                     org_corp.name,
                                     org_corp.pk_corp pk_financeorg,
                                     org_corp.pk_fatherorg,
                                     org_corp.pk_corp,
                                     org_corp.pk_group,
                                     org_financeorg.enablestate
                                FROM org_corp
                                LEFT outer JOIN org_financeorg
                                  ON org_corp.pk_corp =
                                     org_financeorg.pk_financeorg
                               WHERE org_corp.pk_corp IN
                                     (SELECT pk_org
                                        FROM org_orgs
                                       WHERE orgtype5 = 'Y')
                              UNION
                              SELECT org_financeorg.code,
                                     org_financeorg.name,
                                     org_financeorg.pk_financeorg,
                                     org_orgs.pk_corp pk_fatherorg,
                                     org_orgs.pk_corp,
                                     org_financeorg.pk_group,
                                     org_financeorg.enablestate
                                FROM org_financeorg
                                LEFT outer JOIN org_orgs
                                  ON org_financeorg.pk_financeorg =
                                     org_orgs.pk_org
                               WHERE orgtype5 = 'Y'
                                 AND org_financeorg.pk_financeorg <>
                                     org_orgs.pk_corp) org_financeorg_temp
                      where 11 = 11
                        and (enablestate = 2)
                        and ((pk_group =
                            (select pk_group
                                 from org_corp
                                where pk_fatherorg = '~')))
                      order by code) t
              start with pk_financeorg =
                         (select pk_corp
                            from org_corp
                           where pk_fatherorg = '~')
             connect by prior pk_financeorg = pk_fatherorg
              order by level) t3
    on t1.pk_org_p = t3.pk_financeorg;
